import { Component, OnInit } from '@angular/core';
import { HttpService } from '../../service/http.service';
import { HttpRouterService } from '../../service/http-router.service';
import { StorageService } from '../../service/storage.service';
import { Router } from '@angular/router';
import _ from 'underscore';

@Component({
  selector: 'app-pay-record',
  templateUrl: './pay-record.component.html',
  styleUrls: ['./pay-record.component.less']
})
export class PayRecordComponent implements OnInit {

  public param = '';
  public recordList = [];

  constructor(
    private _http: HttpService,
    private _router: Router,
    private _storage: StorageService,
    private _httpRouter: HttpRouterService
  ) { }

  ngOnInit() {
    this.showRecord();
  }

  // 展示交易记录
  showRecord() {
    this.param = 'token=' + this._storage.getLocal('token');
    this._http.post(this._httpRouter.records, this.param).then(res => {
      if (res.code === 1) {
        console.log(res.data);
        this.recordList = res.data;
        this.recordList['create_time'] = res.data.create_time;
      }
    });
  }
}
